package com.beanfactorypostprocessor.child;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

public class ParentBeanFactoryPostProcessor implements BeanFactoryPostProcessor{

	private String parentName;
	
	public void setParentName(String parentName) {
		this.parentName = parentName;
	}
	
	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
		  Parent parent = (Parent) beanFactory.getBean("parent");
		  parent.setParentName(this.parentName);
	}
}